home *** CD-ROM | disk | FTP | other *** search
/ PC World 2004 December / PCWorld_2004-12_cd.bin / software / temacd / tiny / tf6pro-6[1].0.140.exe / Tiny Firewall Pro 6.0.msi / log_ie5.xsl < prev    next >
Encoding:
Extensible Markup Language  |  2004-07-20  |  13.2 KB  |  424 lines

  1. <?xml version='1.0' ?>
  2. <!-- /*//////////////////////////////////////////////////////////////////////
  3. //filename:         log.xsl
  4. //copyright(c):     Tiny Software corp 2002, 2003 (http://www.tinysoftware.com)
  5. //author:         Jozef Palocko (jpalocko@tinysoftware.com)
  6. //product:         Tiny Personal Firewall 5.x                
  7. //description:     Log analyzer stylesheet
  8. //changelog:    
  9. //    18.8.2003 - added displaying date in local time zone
  10. ///////////////////////////////////////////////////////////////////////*/ -->
  11. <xsl:stylesheet version="1.0" 
  12.     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  13.     xmlns:msxsl="urn:schemas-microsoft-com:xslt"
  14.     xmlns:time="http://mycompany.com/mynamespace">
  15.  
  16.  
  17. <xsl:output method="html" indent="yes" />
  18. <msxsl:script language="JScript" implements-prefix="time">
  19.   <![CDATA[
  20.      function LocalTime(node)
  21.    {
  22.        nd = node.nextNode();
  23.         t = new Date(Date.parse(nd.getAttribute("dateTimeLast")));
  24.        return t.toLocaleString( );   
  25.    }
  26.    ]]>
  27. </msxsl:script>
  28.     
  29. <xsl:variable name="Def" select="document('../FncIds.xml ')"/>
  30. <xsl:variable name="Filter" select="document('filter.xml')"/>
  31.    <xsl:template match="/">
  32.    <style> 
  33.        <xsl:text>
  34.        BODY {
  35.                font-family: "MS Sans serif", "Verdana", "Tahoma" ;
  36.                 font-size: 10px;
  37.                 background-color: #ffffff;  
  38.                 color:#000000;
  39.             }       
  40.         .clsFirewall{
  41.             background-color: #dbfeda;  
  42.             height:10px;
  43.             }
  44.         .clsSandbox{
  45.             height:10px;
  46.             background-color: #ffc9c6;  
  47.             }
  48.         .clsIDS{
  49.             height:10px;
  50.             background-color: #ffffd7;  
  51.             }
  52.         .clsEvent{
  53.             background-color: #fafafa;  
  54.             text-align : left;
  55.            margin-bottom: 10px;
  56.             }    
  57.         .clsAllow{
  58.         color =#2e8b57;
  59.         font-weight : bold;
  60.         }            
  61.         .clsPrevent{
  62.         color =#ff0000;
  63.         font-weight : bold;
  64.         }            
  65.         .clsAskUser{
  66.         color =#00ffff;
  67.         font-weight : bold;
  68.         }            
  69.  
  70.  
  71.        </xsl:text>
  72.        </style>
  73.         
  74.         <xsl:call-template name="tplModule">
  75.             <xsl:with-param name="Events" select="/Root/Event"/>
  76.         </xsl:call-template>
  77.    </xsl:template>
  78.    
  79.  <!-- 
  80.  //////////////////////////////////////
  81.  ///////// Named filter templates 
  82.  -->
  83.  
  84.    <!-- ///////// tplModule //////////// -->
  85.  
  86.    <xsl:template name="tplModule" >
  87.        <xsl:param name="Events"/>
  88.        <xsl:choose>
  89.             <xsl:when test="$Filter//module=1">
  90.                 <xsl:call-template name="tplObject">
  91.                     <xsl:with-param name="Events" select="$Events[@module = 1 ]"/>
  92.                 </xsl:call-template>
  93.             </xsl:when>
  94.             <xsl:when test="$Filter//module=2">
  95.                 <xsl:call-template name="tplDirection">
  96.                     <xsl:with-param name="Events" select="$Events[@module = 2 ]"/>
  97.                 </xsl:call-template>      
  98.             </xsl:when>
  99.             <xsl:when test="$Filter//module=16">
  100.                 <xsl:call-template name="tplMessage">
  101.                     <xsl:with-param name="Events" select="$Events[@module = 16 ]"/>
  102.                 </xsl:call-template>      
  103.             </xsl:when>
  104.             <xsl:otherwise>
  105.                 <xsl:call-template name="tplAr">
  106.                     <xsl:with-param name="Events"  select="$Events"/>
  107.                 </xsl:call-template>    
  108.             </xsl:otherwise>
  109.         </xsl:choose> 
  110.    </xsl:template>
  111.  
  112.     <!-- ///////// tplObject //////////// -->
  113.  
  114.    <xsl:template name="tplObject" >
  115.        <xsl:param name="Events"/>
  116.        <xsl:choose>
  117.             <xsl:when test="$Filter//string=''">
  118.                 <xsl:call-template name="tplAr">
  119.                     <xsl:with-param name="Events" select="$Events"/>
  120.                 </xsl:call-template>
  121.             </xsl:when>
  122.             <xsl:otherwise>
  123.                 <xsl:call-template name="tplAr">
  124.                     <xsl:with-param name="Events" select="$Events[contains(
  125.                             translate( Object, '_-\/.:;,ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789' , '_-\/.:;,abcdefghijklmnopqrstuvwxyz0123456789'), 
  126.                     translate($Filter//string,'_-\/.:;,ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789','_-\/.:;,abcdefghijklmnopqrstuvwxyz0123456789'))]"/>           
  127.  
  128.                 </xsl:call-template>
  129.             </xsl:otherwise>
  130.         </xsl:choose> 
  131.    </xsl:template>
  132.    
  133.     <!-- ///////// tplMessage //////////// -->
  134.  
  135.    <xsl:template name="tplMessage" >
  136.        <xsl:param name="Events"/>
  137.        <xsl:choose>
  138.             <xsl:when test="$Filter//string=''">
  139.                 <xsl:call-template name="tplAr">
  140.                     <xsl:with-param name="Events" select="$Events"/>
  141.                 </xsl:call-template>
  142.             </xsl:when>
  143.             <xsl:otherwise>
  144.                 <xsl:call-template name="tplAr">
  145.                     <xsl:with-param name="Events" select="$Events[contains(
  146.                             translate( Msg, '_-\/.:;,ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789' , '_-\/.:;,abcdefghijklmnopqrstuvwxyz0123456789'), 
  147.                     translate($Filter//string,'_-\/.:;,ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789','_-\/.:;,abcdefghijklmnopqrstuvwxyz0123456789'))]"/>           
  148.  
  149.                 </xsl:call-template>
  150.             </xsl:otherwise>
  151.         </xsl:choose> 
  152.    </xsl:template>
  153.  
  154.  
  155.  
  156.    <!-- ///////// tplDirection //////////// -->
  157.       <xsl:template name="tplDirection" >
  158.        <xsl:param name="Events"/>
  159.        <xsl:choose>
  160.             <xsl:when test="$Filter//direction=''">
  161.                 <xsl:call-template name="tplProtocol">
  162.                     <xsl:with-param name="Events" select="$Events"/>
  163.                 </xsl:call-template>     
  164.             </xsl:when>
  165.             <xsl:otherwise>
  166.                 <xsl:call-template name="tplProtocol">
  167.                     <xsl:with-param name="Events" select="$Events[InetDef/@dir = $Filter//direction]"/>
  168.                 </xsl:call-template>
  169.             </xsl:otherwise>
  170.         </xsl:choose> 
  171.    </xsl:template>
  172.  
  173.  
  174.    <!-- ///////// tplProtocol //////////// -->
  175.       <xsl:template name="tplProtocol" >
  176.        <xsl:param name="Events"/>
  177.        <xsl:choose>
  178.             <xsl:when test="$Filter//protocol=''">
  179.                 <xsl:call-template name="tplIPAddress">
  180.                     <xsl:with-param name="Events" select="$Events"/>
  181.                 </xsl:call-template>     
  182.             </xsl:when>
  183.             <xsl:otherwise>
  184.                 <xsl:call-template name="tplIPAddress">
  185.                     <xsl:with-param name="Events" select="$Events[contains(InetDef/@prot , $Filter//protocol)]"/>
  186.                 </xsl:call-template>
  187.             </xsl:otherwise>
  188.         </xsl:choose> 
  189.    </xsl:template>
  190.  
  191.  
  192.     <!-- ///////// tplIPAddress //////////// -->
  193.     <xsl:template name="tplIPAddress" >
  194.        <xsl:param name="Events"/>
  195.        <xsl:choose>
  196.             <xsl:when test="$Filter//ip=''">
  197.                 <xsl:call-template name="tplRemPort">
  198.                     <xsl:with-param name="Events" select="$Events"/>
  199.                 </xsl:call-template>     
  200.             </xsl:when>
  201.             <xsl:otherwise>
  202.                 <xsl:call-template name="tplRemPort">
  203.                     <xsl:with-param name="Events" select="$Events[contains(
  204.                             translate( InetDef/@remIp, '_-\/.:;,ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789' , '_-\/.:;,abcdefghijklmnopqrstuvwxyz0123456789'), 
  205.                     translate($Filter//ip,'_-\/.:;,ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789','_-\/.:;,abcdefghijklmnopqrstuvwxyz0123456789'))]"/>  
  206.                 </xsl:call-template>
  207.             </xsl:otherwise>
  208.         </xsl:choose> 
  209.    </xsl:template>
  210.  
  211.    
  212.    <!-- ///////// tplRemPort //////////// -->
  213.  
  214.    <xsl:template name="tplRemPort" >
  215.        <xsl:param name="Events"/>
  216.        <xsl:choose>
  217.             <xsl:when test="$Filter//remport=''">
  218.                 <xsl:call-template name="tplLocPort">
  219.                     <xsl:with-param name="Events" select="$Events"/>
  220.                 </xsl:call-template> 
  221.             </xsl:when>
  222.             <xsl:otherwise>
  223.                 <xsl:call-template name="tplLocPort">
  224.                     <xsl:with-param name="Events" select="$Events[InetDef/@remPort = $Filter//remport]"/>
  225.                 </xsl:call-template> 
  226.             </xsl:otherwise>
  227.         </xsl:choose> 
  228.    </xsl:template>
  229.    
  230.    <!-- ///////// tplLocPort //////////// -->
  231.  
  232.    <xsl:template name="tplLocPort" >
  233.        <xsl:param name="Events"/>
  234.        <xsl:choose>
  235.             <xsl:when test="$Filter//locport=''">
  236.                 <xsl:call-template name="tplAr">
  237.                     <xsl:with-param name="Events"  select="$Events"/>
  238.                 </xsl:call-template>    
  239.             </xsl:when>
  240.             <xsl:otherwise>
  241.                 <xsl:call-template name="tplAr">
  242.                     <xsl:with-param name="Events" select="$Events[InetDef/@locPort = $Filter//locport]"/>
  243.                 </xsl:call-template>    
  244.             </xsl:otherwise>
  245.         </xsl:choose> 
  246.    </xsl:template>
  247.    
  248.     <!-- ///////// tpl access result //////////// -->
  249.    <xsl:template name="tplAr" >
  250.        <xsl:param name="Events"/>
  251.        <xsl:choose>
  252.             <xsl:when test="$Filter//ar=''">
  253.                 <xsl:call-template name="tplApplication">
  254.                     <xsl:with-param name="Events" select="$Events"/>
  255.                 </xsl:call-template>     
  256.             </xsl:when>
  257.             <xsl:otherwise>
  258.                 <xsl:call-template name="tplApplication">
  259.                     <xsl:with-param name="Events"  select="$Events[Action/@ar = $Filter//ar]"/>
  260.                 </xsl:call-template>
  261.             </xsl:otherwise>
  262.         </xsl:choose> 
  263.    </xsl:template>
  264.  
  265.     <!-- ///////// tplApplication result //////////// -->
  266.  
  267.    <xsl:template name="tplApplication" >
  268.        <xsl:param name="Events"/>
  269.        <xsl:choose>
  270.             <xsl:when test="$Filter//app=''">
  271.                 <xsl:apply-templates select="$Events"/>
  272.             </xsl:when>
  273.             <xsl:otherwise>
  274.                 <xsl:apply-templates  select="$Events[contains(
  275.                             translate( App, '_-\/.:;,ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789' , '_-\/.:;,abcdefghijklmnopqrstuvwxyz0123456789'), 
  276.                     translate($Filter//app,'_-\/.:;,ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789','_-\/.:;,abcdefghijklmnopqrstuvwxyz0123456789'))]"/>           
  277.             </xsl:otherwise>
  278.         </xsl:choose> 
  279.    </xsl:template>
  280.  
  281.  <!-- 
  282.  //////////////////////////////////////
  283.  ///////// Element templates 
  284.  -->
  285.  
  286.    <!-- ///////// Event //////////// -->
  287.    <xsl:template match="Event">
  288.        <div class="clsEvent" >
  289.       <div >
  290.       <xsl:attribute name="class">
  291.        <xsl:choose>
  292.              <xsl:when test="@module=1">clsSandbox</xsl:when>
  293.           <xsl:when test="@module=2">clsFirewall</xsl:when>
  294.           <xsl:when test="@module=16">clsIDS</xsl:when>
  295.          </xsl:choose>
  296.           </xsl:attribute>
  297.  
  298.         <xsl:text>Module: </xsl:text>      
  299.            <xsl:choose>
  300.                      <xsl:when test="@module=1"> <b>Windows security</b> </xsl:when>
  301.                   <xsl:when test="@module=2"> <b>Firewall</b> </xsl:when>
  302.                   <xsl:when test="@module=16"> <b>IDS</b> </xsl:when>
  303.                <xsl:otherwise>
  304.                    <xsl:value-of select="@module"/>
  305.                </xsl:otherwise>
  306.              </xsl:choose>
  307.         
  308.             <xsl:text>  Date: </xsl:text>
  309.             <xsl:value-of select="time:LocalTime(.)"/>
  310. <!--                <xsl:value-of select="@dateTimeLast" />-->
  311.             <xsl:if test="@user">
  312.               <xsl:text>  User: </xsl:text> 
  313.                           <B>[<xsl:value-of select="@user" />] </B>
  314.             </xsl:if> 
  315.             <xsl:if test="@domain">
  316.               <xsl:text> Domain: </xsl:text>
  317.                 <B>[<xsl:value-of select="@domain" />] </B>
  318.             </xsl:if> 
  319.             
  320.       </div>
  321.       <xsl:if test="@count">
  322.          <B> Count: </B>
  323.          <xsl:value-of select="@count" />
  324.       </xsl:if>
  325.      <!--  <xsl:if test="@ruleID">
  326.          <B> RULEID: </B>
  327.          <xsl:value-of select="@ruleID" />
  328.       </xsl:if>
  329.       -->
  330.       <xsl:apply-templates />
  331.        </div>
  332.    </xsl:template>
  333.  
  334.    <!-- ///////// Object //////////// -->
  335.    <xsl:template match="Object">
  336.    <B> Ot: </B>
  337.    <xsl:choose>
  338.         <xsl:when test="@ot='0x00000001'">file</xsl:when>
  339.         <xsl:when test="@ot='0x00000002'">service</xsl:when>
  340.         <xsl:when test="@ot='0x00000004'">registry key</xsl:when>
  341.         <xsl:when test="@ot='0x00000008'">Spawning object</xsl:when>
  342.         <xsl:when test="@ot='0x00000010'">Device</xsl:when>
  343.         <xsl:when test="@ot='0x00000020'">VBA Macro</xsl:when>
  344.         <xsl:when test="@ot='0x00000040'">COM object</xsl:when>
  345.         <xsl:when test="@ot='0x00000080'">System privileges</xsl:when>
  346.         <xsl:when test="@ot='0x00000400'">Transport object</xsl:when>
  347.         <xsl:when test="@ot='0x10000000'">Action</xsl:when>
  348.         <xsl:when test="@ot='0x20000000'">Message</xsl:when>
  349.       </xsl:choose>
  350.       <B>   Object: </B>
  351.       <xsl:value-of select="." />
  352.       <BR />
  353.    </xsl:template>
  354.    
  355.    <!-- ///////// App //////////// -->
  356.    <xsl:template match="App">
  357.       <B>App: </B>
  358.       <xsl:value-of select="." />
  359.       <BR />
  360.       <xsl:if test="@chksm">
  361.          <B> Chksm: </B>
  362.          <xsl:value-of select="@chksm" />
  363.       </xsl:if>
  364.    </xsl:template>
  365.    
  366.    <!-- ///////// Action //////////// -->
  367.    <xsl:template match="Action">
  368.    <B>Action:</B>
  369.        <xsl:choose>
  370.              <xsl:when test="@ar=1">
  371.                 <span class="clsAllow"> Allow </span>
  372.           </xsl:when>
  373.           <xsl:when test="@ar=0">
  374.                 <span class="clsPrevent"> Prevent</span>
  375.           </xsl:when>
  376.           <xsl:when test="@ar=2">
  377.                 <span class="clsAskUser"> Ask User</span>
  378.           </xsl:when>
  379.          </xsl:choose>
  380.  
  381.       <xsl:if test="@fnc">
  382.          <B> Fnc: </B>
  383.          <xsl:variable name="ID" select="@fnc" />    <xsl:value-of select="$Def//Fnc[@id_dec=$ID]" /> (<xsl:value-of select="$ID" />)
  384.          <BR />
  385.       </xsl:if>
  386.    </xsl:template>
  387.    
  388.    <!-- ///////// Msg //////////// -->
  389.    <xsl:template match="Msg">
  390.       <B>Msg: </B>
  391.       <xsl:value-of select="." />
  392.       <br />
  393.    </xsl:template>
  394.    
  395.    <!-- ///////// InetDef //////////// -->
  396.    <xsl:template match="InetDef">
  397.       <B>Prot: </B>
  398.       <xsl:value-of select="@prot" />
  399.       <B>  Dir: </B>
  400.       <xsl:value-of select="@dir" />
  401.       <B>  RemIp: </B>
  402.       <xsl:value-of select="@remIp" />
  403.       <xsl:if test="@locPort">
  404.          <B>  LocPort: </B>
  405.          <xsl:value-of select="@locPort" />
  406.       </xsl:if>
  407.       <xsl:if test="@locPort">
  408.          <B>  RemPort: </B>
  409.          <xsl:value-of select="@remPort" />
  410.          <BR />
  411.       </xsl:if>
  412.       <xsl:if test="@icmpFn">
  413.          <B>  IcmpFn: </B>
  414.          <xsl:value-of select="@icmpFn" />
  415.          <BR />
  416.       </xsl:if>
  417.       <xsl:if test="@locIp">
  418.          <B>  LocIp: </B>
  419.          <xsl:value-of select="@locIp" />
  420.          <BR />
  421.       </xsl:if>
  422.    </xsl:template>
  423. </xsl:stylesheet>
  424.